<fieldset class="ui-widget">
    <legend class="ui-widget-header ui-corner-all">Company details</legend>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'cname'); ?>
    <?php $this->widget('application.widgets.extendedcontrol.extendedcontrol',
              array(
                    'model'=>$model,
                    'attribute'=>'cname',
                    'htmlOptions'=>array('size'=>40),
                    'options'=>array('click'=>'js:function(){alert("this is")}'),
                   )
             );
     ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'address'); ?>
<?php echo CHtml::activeTextArea($model,'address',array('rows'=>3, 'cols'=>39)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'postal'); ?>
<?php echo CHtml::activeTextField($model,'postal',array('size'=>40,'maxlength'=>20)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'country_code'); ?>
<?php echo CHtml::activeDropDownList($model, 'country_code', CHtml::listData(countries::model()->findAll(), 'ccode', 'country'),array('options'=>array('SG'=>array('selected'=>'selected')))); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'email'); ?>
<?php echo CHtml::activeTextField($model,'email',array('size'=>40,'maxlength'=>254)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'pic'); ?>
<?php echo CHtml::activeTextField($model,'pic',array('size'=>40,'maxlength'=>50)); ?>
</div>
</fieldset>
<fieldset id="telephone" class="ui-widget">
    <legend class="ui-widget-header ui-corner-all">Company Telephone No.</legend>
    <?php $n=false; foreach($tele_model as $i=>$item): if($item['type']<10||(count($tele_model)<$i+2 && $n==false)): ?>
<div class="simple">
<?php echo CHtml::activeLabelEx($item,"[$i]ref"); ?>
<?php echo CHtml::activeTextField($item,"[$i]ref",array('size'=>25,'maxlength'=>35)); ?>
<?php echo CHtml::activeDropDownList($item, "[$i]type", array(0=>'General',1=>'Sale',2=>'Accounts',3=>'Exports',4=>'Import',5=>'Enquiry')); ?>
</div>
<?php $n=true; endif;  endforeach; ?>
<?php
    $this->widget('application.widgets.iconcontrol.iconcontrol',
            array('icons'=>array(
                    'new_tele'=>array('icon'=>'ui-icon-plusthick','click'=>'function(){ContactAddItem(true);}','title'=>'Add new telephone'),
                    ),
                    'styleID'=>'alignTop',
            ));
?>
</fieldset>
<fieldset id="fax" class="ui-widget">
    <legend class="ui-widget-header ui-corner-all">Company Fax No.</legend>
<?php $n=false; foreach($tele_model as $i=>$item): if($item['type']>9||(count($tele_model)<$i+2 && $n==false)): if(count($tele_model)<$i+2 && $n==false) {$i++;} ?>
<div class="simple">
<?php echo CHtml::activeLabelEx($item,"[$i]ref"); ?>
<?php echo CHtml::activeTextField($item,"[$i]ref",array('size'=>25,'maxlength'=>35)); ?>
<?php echo CHtml::activeDropDownList($item, "[$i]type", array(10=>'General',11=>'Sale',12=>'Accounts',13=>'Exports',14=>'Import',15=>'Enquiry')); ?>
</div>
<?php $n=true; endif; endforeach; ?>
<?php
    $this->widget('application.widgets.iconcontrol.iconcontrol',
            array('icons'=>array(
                    'new_fax'=>array('icon'=>'ui-icon-plusthick','click'=>'function(){ContactAddItem(false)}','title'=>'Add new fax'),
                    ),
                    'styleID'=>'alignTop',
            ));
?>
</fieldset>